<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
	<link href="/public/static/Ryan_share/ydui.css" rel="stylesheet">
	<link rel="shortcut icon" href=style/favicon.ico type=image/x-icon>
    <title>APP下载 - {$app_name}</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
</head>
<body>
	<style type="text/css">
	    body{background-color: #fff;max-width:600px;text-align:center;margin:0 auto;}
		#ppt{width: 100%;}
		#main{width: 100%;padding: 0% 10%;text-align: center;margin: auto;}
		#invite_code{width: 100%;margin-top: 30px;height: 40px;line-height: 40px;font-size: 15px;}
		#invite_code .code{width: 60%;border: #f9617e  solid 1px;border-radius: 15px 0px 0px 15px;float: left;text-align: left;padding: 0px 20px;line-height:40px;text-align:center;font-size:18px;letter-spacing:1px;color: #fd5379;font-weight: bold;}
		#fenge{color:#fff;float:left;}
		#invite_code .copy{width: 40%;border: #fa6584  solid 1px;border-radius: 0px 15px 15px 0px;float: right;background: linear-gradient(270deg,#FF305E 0%,#Fb6e8e 100%); box-shadow: 0 0.06rem 0.16rem 0 rgba(243,74,88,.4);color: #fff;}
		#note{width: 100%;color: #444; font-size: 14px; margin-top: 20px;}
		#download{margin-top: 20px;}

      #download a{background: linear-gradient(270deg,#FF305E 0%,#Fb6e8e 100%); box-shadow: 0 0.06rem 0.16rem 0 rgba(243,74,88,.4);color: #fff;font-size: 16px;border-radius: 20px;border: none;font-size: 15px;height: 40px;padding: 10px 30px;}
		
		#wechat_float{width:100%;height:100%;position:fixed;top:0px;right:0px;z-index:999;background: rgba(0,0,0,0.9 );color:#fff;display:none;}
		#wechat_float img{float:right;margin-right:5%;}
		#wechat_float p{float:right;font-size:15px;width:100%;padding:2% 15%;}
		#wechat_float button{background-color:#fff;color:#333;padding:7px 30px;border:none;border-radius:8px;}
	</style>
	<div id="ppt">
				<div class="slider-item">
					<img src="{$wap_index_img}">
				</div>

	
	</div>
	
	<div id="main">
      
      
		<div id="download">
		<!--	<a href="{$app_android_down}" type="android" style="margin-right: 10px;">安卓下载</a> 
			<a href="{$app_ios_down}" type="ios">iOS下载</a>-->
			<a   onclick="down()"  type="down"  style="margin-right: 10px;">下载APP</a> 
	
		</div>
      
          <br><br>
      
		<div id="invite_code">
			<div class="code">{$share_ma}</div>
			<div class="copy" data-clipboard-text="{$share_ma}">复制邀请码</div>
			<div class="copy_a" data-clipboard-text="{$share_ma}"></div>
		</div>
		<div id="note">
			<p>请先复制邀请码，用于激活APP使用资格！</p>
		</div>
	</div>
	
	<div id="wechat_float">
	  
   <img src="" alt="浏览器打开" />
	    <br><p>
	        微信中不能下载，请在右上角选择“在浏览器中打开”
	      <br><br>
	        <button onclick="$('#wechat_float').hide();">知道了</button>
	    </p>
	</div>
	<script src="/public/static/Ryan_share/jquery.min.js"></script>
	<script src="/public/static/Ryan_share/ydui.js"></script>
	<script src="/public/static/Ryan_share/clipboard.min.js"></script>
  
	<script type="text/javascript">
 
      
  var browser = {
versions: function () {
var u = navigator.userAgent, app = navigator.appVersion;
return { //移动终端浏览器版本信息 
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器 
iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 
iPad: u.indexOf('iPad') > -1, //是否iPad 
};
}(),
}
   
      
      
      
      
      
      
      
            //点击下载
            $('#download a').click(function() {
                //

                    $('.copy_a').click();

              
              
            });       
      
      
      
    /*  
setInterval(startDebug, 100); // 举个例子而已，很多网站并不是这么实现的
function startDebug() { debugger; };
      
      */
      
    function down(){
      
         
                    $('.copy_a').click();
      
  
                      if (is_wechat()) {
                    //微信内置浏览器不能下载
                    $('#wechat_float').fadeIn("fast");
                    return false;
                }

      
  if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {
  window.location.href ="{$app_ios_down}";
}
if (browser.versions.android) {
  window.location.href ="{$app_android_down}";
}     
      
   /*   
 if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //判断iPhone|iPad|iPod|iOS
 // alert(navigator.userAgent); 
  //           var iosShade = document.getElementById('iosShade')
//            iosShade.style.display = 'block'

} else if (/(Android)/i.test(navigator.userAgent)) {  //判断Android
// alert(navigator.userAgent); 
  window.location.href ="{$app_android_down}";
} else { //pc
  window.location.href ="{$app_android_down}";
};
      
      */
  }      
      
      
      

        $(function() {
            //初始化数据
            var invite_code = getQ('invite_code');
            if (invite_code != '') {
                $('.code').html(invite_code);
                $('.copy').attr('data-clipboard-text', invite_code);
                $('.copy_a').attr('data-clipboard-text', invite_code);
            }
            //点击复制
            var clipboard = new Clipboard('.copy');
          
            clipboard.on('success',
            function(e) {
                oncopy = true;
                YDUI.dialog.toast('邀请码已复制', 'success', 2000);
            });
          
            clipboard.on('error',
            function(e) {
                oncopy = true;
                YDUI.dialog.toast('复制失败，请手动复制邀请码', 'error', 3000);
            });
          

          

            //点击复制 自动复制
            var clipboard = new Clipboard('.copy_a');
          /*
            clipboard.on('success',
            function(e) {
                oncopy = true;
                YDUI.dialog.toast('邀请码已复制-自动', 'success', 2000);
            });
          */
            clipboard.on('error',
            function(e) {
                oncopy = true;
                YDUI.dialog.toast('复制失败，请手动复制邀请码', 'error', 3000);
            });
                    
          
    
        });      
          
          
          
      /*    
            //点击下载
            $('#download a').click(function() {
                //
            //    let type = $(this).attr('type');
                if (is_wechat()) {
                    //微信内置浏览器不能下载
                    $('#wechat_float').fadeIn("fast");
                    return false;
                }

              
              
            });  */
        
       function getQ(name) {
            var r = window.location.search.substr(1);
            var key = name + '=';
            if (r.indexOf(key) == -1) return '';
            r = r.substring(r.indexOf(key) + key.length);
            if (r.indexOf('&') != -1) {
                r = r.substring(0, r.indexOf('&'));
            }
            if (r == 'null' || r == null) {
                return '';
            }
            return r;
        }
       
        function is_wechat(){
            var ua = window.navigator.userAgent.toLowerCase();
            //通过正则表达式匹配ua中是否含有MicroMessenger字符串
            if(ua.match(/MicroMessenger/i) == 'micromessenger'){
                return true;
            }else{
                return false;
            }
        }
	</script>
	

</body>
</html>